dynamic_lib = libmysub_mul.so
static_lib = libmyadd.a

.PHONY:all
all:$(dynamic_lib) $(static_lib)


$(static_lib):test1.o
	ar -rc $@ $^
test1.o:test1.c
	gcc -c $^

$(dynamic_lib):test2.o test3.o
	gcc -shared -o $@ $^
test2.o:test2.c
	gcc -fPIC -c $^
test3.o:test3.c
	gcc -fPIC -c $^


.PHONY:clean
clean:
	rm -rf *.a *.so *.o mylib

.PHONY:output
output:
	mkdir -p mylib/include
	mkdir -p mylib/lib
	cp *.h mylib/include
	cp *.so mylib/lib
	cp *.a mylib/lib

